package com.code.day17;

import java.util.function.Function;

public class Demo12Stream {
    public static void main(String[] args) {
//        method(new Function<String, Person>() {
//            @Override
//            public Person apply(String s) {
//                return new Person();
//            }
//        }, "刘大胆");
        method(Person1::new,"刘大胆");
    }

    /**
     * String类型转Person1类
     * @param function
     * @param name
     */
    public  static  void method(Function<String,Person1> function , String name){
            Person1 person1 = function.apply(name);
            System.out.println(person1);
    }
}
